<extend name="Public:base" />
<block name="content">
<div id="primary" class="inner group">
   <div id="slogan" class="inner">
      <h1>{$res['title']}</h1>

      <div style="height:7px">
         
      </div>
      <h3 style="float:right;margin-right:10px">由&nbsp;&nbsp;<span style="color:#6950a1;font-size:13px">{$username['username']}</span>&nbsp;&nbsp;于&nbsp;&nbsp;{$res['c_time']}&nbsp;&nbsp;时发表&nbsp;&nbsp;&nbsp;&nbsp;热度：<span style="color:red">{$res['hot']}&nbsp;℃</span></h3>
   </div>
   <div style="height:10px">
      
   </div>
   <div class="layout-sidebar-right">
      <!-- START CONTENT -->
      <div id="content" role="main" class="group wrapper-content">
         <div style="width:770px;position:relative;left:100px"  id="post-663" class="post-663 page type-page status-publish hentry group">
            <span class="special-font" style="font-size:24px;"><img src="{$res['pic']}" style="width:770px;height:300px;/*position:relative;left:100px*/"></span>
               <div style="height:7px">
                  
               </div>
            <span style="font-size:15px;">{$res['content']}</span>
         </div>
      </div>  
   </div>
    <div style="height:7px">
                  
   </div>
   <!-- START EXTRA CONTENT -->
   <div class="extra-content group" style="padding-left:90px;">
      <br>
      <foreach name="as" item="v">
         <div style="float:left;margin:10px;" class="hentry-post group">
               <div class="thumb-img"><a href="article.html?id={$v['id']}"><img style="width:155px;height:100px" src="{$v['pic']}" class="attachment-thumb_recentposts wp-post-image" alt="blog2" title="{$v['introduce']}"></a></div>
               <a href="article.html?id={$v['id']}" title="{$v['introduce']}" class="title">{$v['title']}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$v['hot']}℃</a>
               <p class="post-date">{$v['introduce']}</p>
               <p class="post-date">{$v['c_time']}</p>
               <a class="read-more" title="查看文章" href="article.html?id={$v['id']}">Read more</a>
            </div>
      </foreach>
   </div>
   <!-- END EXTRA CONTENT  -->  
   <div class="layout-sidebar-right group">
      <div id="comments" style="width:770px;position:relative;left:100px" >
         <h3 id="comments-title">{:count($pinglun)} <span>条评论</span></h3>
         <if condition='($pinglun eq null)'>
         <h1>&nbsp;</h1>
         <span style="color:#ccc;font-size:20px">此篇文章还没有人评论哦</span>
         <h1>&nbsp;</h1>      
         </if>
    
         <!-- LIST COMMENTS -->
         <ol class="commentlist">
            
            <foreach name="pinglun" item="v">
               <li class="comment depth-1">
                  <div class="comment-container">
                     <div class="comment-author vcard">
                         <img alt="" src="{$v['pic']}" class="avatar avatar-75 photo" height="75" width="75">             
                        <div class="shadow-avatar-comment"></div>
                               <cite class="fn">{$v.name}</cite>           
                     </div><!-- .comment-author .vcard -->
                     
                     <div class="comment-meta commentmetadata">
                        <div class="intro">
                              <div class="commentDate">
                                <a href="#">{$v['c_time']}</a> 
                             <a class="comment-edit-link" href="#" title="Edit comment"></a>                
                           </div>
            
                           <div class="commentNumber">#&nbsp;1</div>
                        </div>
                           
                        <div class="comment-body">
                           <p>{$v['contents']}</p>
                        </div>
                        
                        <div class="reply">
                           <input type="hidden" name="one" value="{$v['id']}"/>
                           <a name="one" rel="nofollow" class="comment-reply-link" href="#" onclick="return false">Reply</a>      

                        </div><!-- .reply -->
                     </div><!-- .comment-meta .commentmetadata -->
                  </div><!-- #comment-##  -->
                  <div style="height:10px"></div>
                  <div name="one" style="display:none;position:relative;left:368px;width:400px;height:220px;border:1px solid #ccc;background-color:pink;opacity:0.3" >
                  <form action='/home/blog/article/reply' method="post">
                     &nbsp;&nbsp;&nbsp;<label style="font-size:20px"><b>回复：<span style="color:blue;font-size:10px">{$v['name']}</span></b></label><br><br>
                     <input type="hidden" name="reid" value="{$v[id]}"/>
                     <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><textarea name="contents" style="resize:none" rows="7" cols="40"></textarea>
                     <!-- <button type="button" style="position:relative;left:340px">提交</button> -->
                     <input type="submit" name="one" value="提交"/>
                  </form>
                  </div>
                  <foreach name="reply" item="vv">
                     <if condition="($vv['reid'] eq $v['id'])">
                     <ul class="children">
                        <li class="comment bypostauthor depth-2">
                           <div class="comment-container">
                              <div class="comment-author vcard">
                                  <img alt="" src="{$vv['pic']}" height="75" width="75">             
                                 <div class="shadow-avatar-comment"></div>
                                          <cite class="fn">{$vv['name']}</cite>         
                              </div><!-- .comment-author .vcard -->
                                 
                              <div class="comment-meta commentmetadata">
                                 <div class="intro">
                                       <div class="commentDate">
                                         <a href="#">{$vv['c_time']}</a> 
                                      <a class="comment-edit-link" href="#" title="Edit comment"></a>                
                                    </div>
                     
                                    <div class="commentNumber">#&nbsp;2</div>
                                 </div>
                                 
                                 <div class="comment-body">
                                    <p>{$vv['contents']}</p>
                                 </div>
                              
                              
                                 <div class="reply">
                                     <input type="hidden" name="two" value="{$vv['id']}"/>
                                    <a name="two" rel="nofollow" class="comment-reply-link" href="#" onclick="return false">Reply</a>             
                                 </div><!-- .reply -->
                              </div><!-- .comment-meta .commentmetadata -->
                     
                           </div><!-- #comment-##  -->
                           <div style="height:10px"></div>
                            <div name="two" style="display:none;position:relative;left:270px;width:400px;height:220px;border:1px solid #ccc;background-color:yellow;opacity:0.3" >
                           <form action='/home/blog/article/huifu' method="post">
                              &nbsp;&nbsp;&nbsp;<label style="font-size:20px"><b>回复：<span style="color:blue;font-size:10px">{$vv['name']}</span></b></label><br><br>
                              <input type="hidden" name="huifuid" value="{$vv[id]}"/>
                              <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><textarea name="contents" style="resize:none" rows="7" cols="40"></textarea>
                              <!-- <button type="button" style="position:relative;left:340px">提交</button> -->
                              <input type="submit" name="two" value="提交"/>
                            </form>
                            </div>
                           <foreach name="huifu" item="vvv">
                              <if condition="($vvv['huifuid'] eq $vv['id'])">
                              <ul class="children">
                                 <li class="comment bypostauthor depth-2">
                                    <div class="comment-container">
                                       <div class="comment-author vcard">
                                           <img alt="" src="{$vvv['pic']}" height="75" width="75">             
                                          <div class="shadow-avatar-comment"></div>
                                                   <cite class="fn">{$vvv['name']}</cite>         
                                       </div><!-- .comment-author .vcard -->
                                          
                                       <div class="comment-meta commentmetadata">
                                          <div class="intro">
                                                <div class="commentDate">
                                                  <a href="#">{$vvv['c_time']}</a> 
                                               <a class="comment-edit-link" href="#" title="Edit comment"></a>                
                                             </div>
                              
                                             <div class="commentNumber">#&nbsp;3</div>
                                          </div>
                                          
                                          <div class="comment-body">
                                             <p>{$vvv['contents']}</p>
                                          </div>
                                       
                                       
                                          <div class="reply">
                                             <a rel="nofollow" class="comment-reply-link" href="#" onclick="return false"></a>             
                                          </div><!-- .reply -->
                                       </div><!-- .comment-meta .commentmetadata -->
                              
                                    </div><!-- #comment-##  -->
                              
                                 </li>
                              </ul>
                              </if>
                           </foreach>
                     
                        </li>
                     </ul>
                     </if>
                  </foreach>
               </li>
            </foreach>
         </ol>
         <!-- END LIST COMMENTS -->
        
         <!-- RESPOND -->
         
         <div id="respond">
            <h3 id="reply-title">Leave a Reply</h3>
            
            <form id="commentform" method="post" action="/home/blog/article/pinglun">                                      
               <input type="hidden" name="aid" value="{$res['id']}"/>
               <p class="comment-form-comment">
                  <label for="comment"><img style="width:80px;height:80px" class="comment-avatar" alt="avatar" src="<if condition="$per">{$per['pic']}<else />__PUBLIC__/home/images/blog/avatar.jpg</if>"></label>
                  <if condition="($per)">
                  <textarea aria-required="true" rows="8" cols="45" info="info" name="contents" id="comment"></textarea>
               </p>              
            
               <p class="form-submit">
                  <input type="submit" info="info" value="提交评论" id="submit" name="submit">
               </p>
                  <else />
                  <textarea readonly aria-required="true" rows="8" cols="45" name="contents" id="comment">您还没有登录哦，还不能提交评论</textarea>
               </p>              
            
               <p class="form-submit">
                  <input type="submit" info="info" disabled value="提交评论" id="submit" name="submit">
               </p>
                  </if>
               
               <div class="clear"></div>
            
            </form>
         </div><!-- #respond -->
      </div>
   </div>
   <!-- START EXTRA CONTENT -->
   <!-- END EXTRA CONTENT -->    
</div>
<input type="hidden" name="session" value="{:session('home_id')}"/>
 <script type="text/javascript">
   $('a[name="one"]').click(function(){
      var reid=$(this).prev().val();
      $('div[name="two"]').slideUp("slow");
      $(this).parent().parent().parent().next().next().slideToggle("slow");
      // console.log(reid);
      return false;
   });
   $('a[name="two"]').click(function(){
      var huifuid=$(this).prev().val();
      $('div[name="one"]').slideUp("slow");
       $(this).parent().parent().parent().next().next().slideToggle("slow");
      // console.log(huifuid);
      return false;
   });
   $(document).click(function(){
       $('div[name="one"]').slideUp("slow");
       $('div[name="two"]').slideUp("slow");
   });
   $('div[name="one"]').click(function(){
      return false;
   });
   $('div[name="two"]').click(function(){
      return false;
   });
   $('input[type="submit"]').click(function(){
      return true;
   });
   $('input[name="one"]').click(function(){
     var reid=$(this).prevAll().eq('2').val();
     var contents=$(this).prevAll().eq('0').val();
     var aid=$('input[name="aid"]').val();
     $.ajax({
      url:'/home/blog/article/reply',
      data:{'aid':aid,'reid':reid,'contents':contents},
      type:'post',
      success:function(mes){
         eval(mes);
      }
     });
   });
   $('input[name="two"]').click(function(){
     var huifuid=$(this).prevAll().eq('2').val();
     var contents=$(this).prevAll().eq('0').val();
     var aid=$('input[name="aid"]').val();
     $.ajax({
      url:'/home/blog/article/huifu',
      data:{'aid':aid,'huifuid':huifuid,'contents':contents},
      type:'post',
      success:function(mes){
         eval(mes);
      }
     });
   });
   if($('input[name="session"]').val()==''){
      $('a[name="one"]').css({'position':'absolute','z-index':-1});
      $('a[name="two"]').css({'position':'absolute','z-index':-1});
   }
</script>
    

</block>